The present invention relates to a method for detecting or estimating an existing area of a two-dimensional code on an image data memory, and also relates to a method for reading the information from the two-dimensional code identified by the above detecting or estimating method. The present invention further relates to a recording medium capable of storing a program of the code existing area detecting or estimating method as well as a program of the code reading method of the present invention, which is installable in a computer system or a comparable digital circuit.
The Unexamined Japanese Patent Publication No. 10-198754 discloses a conventional code reader which searches a two-dimensional code image by using representative scanning lines.
The U.S. Pat. No. 5,764,798 discloses prioritized searching methods for finding a coded symbol in digitized image by setting search lines of various directions.
An object of the present invention is to provide a method for efficiently and promptly estimating or detecting an existing area of a two-dimensional code or an information code.
Another object of the present invention is to reduce an overall processing time in the reading operation of a two-dimensional code or an information code.
Another object of the present invention is to store the methods of the present invention in a recording medium, as a program installable in a computer system or a comparable digital circuit.
The present invention provides a first method for estimating an existing area of an information code, comprising a step of inputting a two-dimensional image of an information code, a step of storing image data of a predetermined image region on an image data memory, the image data including the two-dimensional image of the information code, and a step of estimating an existing area of the information code in the image region of the image data memory based on the stored image data.
The first method further comprises a step of dissecting the image region into a plurality of search sections, a step of counting brightness change points in each of the search sections based on image data of each search section, a step of detecting a candidate region having a likelihood of involving the information code based on the count value of the brightness change points, and a step of identifying the candidate region as the existing area of the information code.
Preferably, in the first method, the plurality of search sections are rectangular sections dissected or segmented by lines parallel to a main scanning line used for scanning the image region in a horizontal direction and also by lines parallel to a sub scanning line used for scanning the image region in a vertical direction.
Preferably, in the first method, the information code consists of a plurality of cells arranged in a two-dimensional pattern, and each of the search sections is larger than a minimum size of the cell on the image data memory. For example, each of the search sections is larger than two times the minimum size of the cell on the image data memory.
Preferably, in the first method, the search sections are arranged so as to correspond to each main scanning line used in a horizontal scanning operation of the image region.
Preferably, in the first method, each of the search sections is further dissected or segmented into a plurality of smaller search sections.
Preferably, in the first method, the candidate region consists of consecutive search sections, and a higher priority is given to a candidate region positioned near the center of the image region when a plurality of candidate regions are detected. In addition to the above, it is preferable to give a higher priority to a candidate region having a large value in the total number of consecutive search sections involved therein.
Preferably, in the first method, the search sections are arranged in a hierarchical structure so that one upper-grade search section is dissected into a plurality of lower-grade search sections. In this case, the first method further comprises a step of comparing a count value of brightness change points in each upper-grade search section with a predetermined upper-grade threshold, a step of detecting a candidate region consisting of consecutive upper-grade search sections having a count value of brightness change points equal to or larger than the upper-grade threshold, a step of comparing a count value of brightness change points in each lower-grade search section with a predetermined lower-grade threshold when this lower-grade search section belongs to an upper-grade search section positioned in the vicinity of the candidate region, a step of adding the lower-grade search section to the candidate region when this lower-grade search section has a count value of brightness change points equal to or larger than the lower-grade threshold, and a step of identifying the candidate region including the added lower-grade search section as the existing area of the information code.
Preferably, in the first method, a counting operation of brightness change points is performed in parallel with a storing operation of the image data into the image data memory, and a count table is used to obtain the relationship between the counted data of the brightness change points and corresponding search sections, so that the existing area of the information code can be estimated based the data of the count table. For example, the counting operation of the brightness change points includes the steps of renewing a memory region in response to an input of image data so as to store both a brightest data and a darkest data among brightness-related data having been ever received, calculating a mid value equivalent to an average of the brightest data and the darkest data, comparing a newly entered data with the mid value to make a bright-dark judgement, and counting each change in the result of the bright-dark judgement as a brightness change point. Furthermore, a darkness upper limit and a brightness lower limit are used in the bright-dark judgement. The darkness upper limit is darker than the brightest data by a predetermined darkness margin. The brightness lower limit is brighter than the darkest data by a predetermined brightness margin. The bright-dark judgement results in xe2x80x9cbrightxe2x80x9d when the newly entered data is not smaller than both of the mid value and the brightness lower limit, and results in xe2x80x9cdarkxe2x80x9d when the newly entered data is smaller than the mid value and not larger than the darkness upper limit.
Preferably, the first method further comprises a step of scanning each search section by a plurality of scanning lines, a step of counting the brightness change points along each scanning line, a step of obtaining a cumulative count value by counting the number of the brightness change points cumulatively until the search section is completely scanned by the plurality of scanning lines, and a step of obtaining the total number of the brightness change points of each search section based on the cumulative count value.
Preferably, the first method further comprises the steps of obtaining an average of brightness-related values of the image data involved in the search section, and using the average of brightness-related values as one of judging conditions for detecting and identifying the candidate region.
The present invention provides a second method for reading an information code, comprising a step of inputting a two-dimensional image of an information code, a step of storing image data of a predetermined image region on an image data memory, the image data including the two-dimensional image of the information code, a step of dissecting the image region into a plurality of search sections, a step of counting brightness change points in each of the search sections based on image data of each search section, a step of detecting a candidate region having a likelihood of involving the information code based on the count value of the brightness change points, a step of identifying the candidate region as an existing area of the information code in the image region of the image data memory, a step of setting search lines only in a limited region corresponding to the candidate region, a step of detecting the existing area of the information code by searching the image data along the plurality of search lines, and a step of reading the contents of the information code involved in the detected existing area based on the image data of the detected existing area.
The present invention provides an information code reading apparatus, according to which an input means is provided for inputting a two-dimensional image of an information code. The image data memory is provided for storing image data of a predetermined image region entered from the input means. The image data includes the two-dimensional image of the information code. An existing area detecting means is provided for estimating an existing area of the information code in the image region of the image data memory based on the stored image data, by dissecting the image region into a plurality of search sections, counting brightness change points in each of the search sections based on image data of each search section, detecting a candidate region having a likelihood of involving the information code based on the count value of the brightness change points, and identifying the candidate region as the existing area of the information code. And, a reading means is provided for reading the information code involved in the detected existing area based on the image data of the detected existing area.
Furthermore, the present invention provides a first storing medium for storing a program installable in a computer system for detecting the existing area of an information code on an image data memory in accordance with the above first method.
Furthermore, the present invention provides a second storing medium for storing a program installable in a computer system for reading an information code on an image data memory in accordance with the above second method.